package com.spsy.pay.config;

import com.spsy.pay.canstand.RabbitMqCanstand;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author: liuzhiping
 * @date: 2025/6/9 15:33
 **/
@Configuration
public class RabbitmqConfig {

    @Bean
    public Queue createQueue(){
        return  new Queue(RabbitMqCanstand.MQ_NAME,true);
    }

    @Bean
    public Queue createQueue2(){
        return  new Queue("2210a_queue_a1",true);
    }


    @Bean
    public DirectExchange createDirectExchange(){
        return  new DirectExchange(RabbitMqCanstand.EXCHANGE_NAME);
    }

    @Bean
    public  Binding createBinding(){

        return BindingBuilder.bind(this.createQueue()).to(this.createDirectExchange()).with(RabbitMqCanstand.ROTEING_KEY_NAME);


    }

    @Bean
    public  Binding createBinding2(){

        return BindingBuilder.bind(this.createQueue2()).to(this.createDirectExchange()).with(RabbitMqCanstand.ROTEING_KEY_NAME2);


    }


}
